<?php if (!strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6')) echo '<?xml version="1.0" encoding="UTF-8"?>'. "\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $direction; ?>" lang="<?php echo $lang; ?>" xml:lang="<?php echo $lang; ?>">
<head>
<title><?php echo $title; ?></title>
<?php if ($description) { ?>
<meta name="description" content="<?php echo $description; ?>" />
<?php } ?>
<base href="<?php echo $base; ?>" />
<?php if ($icon) { ?>
<link href="<?php echo $icon; ?>" rel="icon" />
<?php } ?>
<?php foreach ($links as $link) { ?>
<link href="<?php echo str_replace('&', '&amp;', $link['href']); ?>" rel="<?php echo $link['rel']; ?>" />
<?php } ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/stylesheet.css" />

<!--[if IE]>
<style type="text/css" media="screen">
#loginxpanded{
 top:10px;
}
</style>
<![endif]-->

<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/ie6.css" />
<script type="text/javascript" src="catalog/view/javascript/DD_belatedPNG_0.0.8a-min.js"></script>
<script>
DD_belatedPNG.fix('img, #header .div3 a, #content .left, #content .right, .box .top');
</script>
<![endif]-->

<?php foreach ($styles as $style) { ?>
<link rel="<?php echo $style['rel']; ?>" type="text/css" href="<?php echo $style['href']; ?>" media="<?php echo $style['media']; ?>" />
<?php } ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/jquery-latest.min.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/thickbox/thickbox-compressed.js"></script>
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/thickbox/thickbox.css" />
<script type="text/javascript" src="catalog/view/javascript/jquery/tab.js"></script>
<?php foreach ($scripts as $script) { ?>
<script type="text/javascript" src="<?php echo $script; ?>"></script>
<?php } ?>
<script type="text/javascript"><!--
function bookmark(url, title) {
	if (window.sidebar) { // firefox
    window.sidebar.addPanel(title, url, "");
	} else if(window.opera && window.print) { // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} else if(document.all) {// ie
   		window.external.AddFavorite(url, title);
	}
}
//--></script>
</head>
<body>
<?php $curadd = $_SERVER['REQUEST_URI']; ?>

<!-- <div id="main-banner"><img src="image/data/advert-01.jpg" /></div> -->

<div id="wrapper">

<div id="container">
<div id="header">
  <div class="topmost">
  <div class="div1">
    <div class="div2">


      <div class="logo" onclick="location.href='index.php?route=common/home';"></div>
	  
	  <?php // Customisation start of register/login Block ?>
	  <div id="user_menu">
      <?php if (!$logged) { ?>

          <span id="loginx">
          <a><div id="login-overlay"></div></a>
          </span>
		  <?php // |  ?>
          <div id="register" onclick="location.href='index.php?route=account/create';">
          <?php //<a href="index.php?route=account/create"><span>Register</span></a> ?>
          </div>
          
          <!--<div id="wishlistinv">
      	  </div>-->
          
      <?php } else { ?>
      <div id="logout" onclick="location.href='index.php?route=account/logout';">
      </div>
      
      <div id="wishlist" onclick="location.href='index.php?route=checkout/cart';">
      </div>

      <?php } ?>
      </div>

	  
      <?php //start of login box wrapper ?>
      <div id="loginxpanded" style="">
      
      <?php //start of login box ?>
     
     
     	<div style="background: #F7F7F7; border: 1px solid #DDDDDD; padding: 10px; min-height: 180px;">
     		<p align="right"><span id="closeLogin"><a><?php  echo  $text_close; ?></a></span></p>
            <?php  echo  $text_greeting_customer; ?>
          <form action="<?php echo $login; ?>" method="post" enctype="multipart/form-data" id="login">
          	<table border="0" cellspacing="0" cellpadding="3">
            <tr><td><b><?php echo $text_entry_email; ?></b></td><td><input type="text" name="email" /></td></tr>
            <tr><td><b><?php echo $text_entry_password; ?></b></td><td><input type="password" name="password" /></td></tr>
            <tr><td></td><td><input type="button" value="<?php echo $text_btn_login; ?>" onclick="$('#login').submit();" /></td></tr>
            </table>
            <br />
            <a href="index.php?route=account/forgotten"><?php echo  $text_forgotten_password; ?></a><br /> 
            <?php if ($redirect) { ?>
            <input type="hidden" name="redirect" value="<?php echo str_replace('&', '&amp;', $redirect); ?>" />
            <?php } ?>
          </form>
        </div>
        
        <?php //end of login box ?>
      
      </div>
      <?php //end of login box wrapper ?>
      
      	<script>
			/* for displaying the box */
			$("#loginx").click(showLoginFields);
			  
			function showLoginFields() {
				 $("#loginxpanded").fadeIn("slow");
			}
			
			$("#closeLogin").click(hideLoginFields);
			  
			function hideLoginFields() {
				 $("#loginxpanded").fadeOut("slow");
			}
			
			/*furter codes for login submission */
			$('#login input').keydown(function(e) {
				if (e.keyCode == 13) {
					$('#login').submit();
				}
			});
		</script>

	</div>
    
    <?php //End of Customisation register/login Block ?>
	
    
    <?php //The Search Text Box ?>
    <div class="div9">
    <table border="0"><tr><td>
        <input type="text" value="<?php //echo $text_keyword; ?>" id="filter_keyword" onclick="this.value = '';" onkeydown="this.style.color = '#000000';" style="color: #999; border:none; background:transparent; border:none" size="37" />
        </td><td>
        <div class="searchbox">
            <a onclick="moduleSearch();" style="text-decoration:none; color:#013467;">
            <span style="font:bold;"><?php echo $button_go; ?></span>
            </a>      
    	</div>
    </td></tr></table>
    </div> 
    <?php //End of Search Box ?>
    
    
     <?php //Block for category selector ?>

      <div class="category_jump_menu">
        <?php /* Jump Menu */ ?>
        <script type="text/JavaScript" language="JavaScript">
        <!--
        function jumpmenu(target,obj,restore){
          eval(target+".location='"+obj.options[obj.selectedIndex].value+"'");
        }		
        //-->
        </script>
  
        <select onchange="jumpmenu('parent',this)" id="selectcategory">
        <option value='#'>Choose Category</option>
        <?php foreach ($categories as $category) { ?>
        <option value="index.php?route=product/category&path=<?php echo $category['category_id']; ?>"><?php echo $category['name']; ?></option>
        <?php } ?>
        </select>
        <div style="display:inline; position:relative; top:5px; vertical-align:top; padding-left:5px">
        <?php //echo $menu_jump; ?>
        </div>
        <?php /* EO Jump Menu */ ?>
      </div>

    <?php //End of block ?>
    
	
    </div><?php /*eo div 1 */ ?>
    
       
  </div>
  
  <?php if (($curadd == "/demo/") || ($curadd == "/demo/index.php?route=common/home"))
	  {$param = " style='height:200px;'";}
  else
	  {$param = "";}
  ?>
  <?php // Banner ?>
  <div class="banner1" <?php echo $param ?> >
	<?php if (isset($category_banner)) {  ?>
		<img src="image/<?php echo $category_banner ?>">
	<?php } else { ?>
		<img src="image/data/banner.png">
	<?php } ?>
  <br/>
  </div>
  <?php // End of banner ?>
  
<?php //Hide the breadcrumbs ?>  
<?php if (($curadd == "/demo/") || ($curadd == "/demo/index.php?route=common/home"))
{
}
//nothing
else
{
?>
  <div class="div6">
    <div class="left"></div>
    <div class="right"></div>
    <div class="center">
      <div id="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?>
            <a href="<?php echo str_replace('&', '&amp;', $breadcrumb['href']); ?>">
                <?php echo $breadcrumb['text']; ?>
            </a>
        <?php } ?>
      </div>
      <div class="div7">
      </div>
    </div>
  </div>
<?php 
}
?>
  
</div>
<script type="text/javascript"><!-- 
function getURLVar(urlVarName) {
	var urlHalves = String(document.location).toLowerCase().split('?');
	var urlVarValue = '';
	
	if (urlHalves[1]) {
		var urlVars = urlHalves[1].split('&');

		for (var i = 0; i <= (urlVars.length); i++) {
			if (urlVars[i]) {
				var urlVarPair = urlVars[i].split('=');
				
				if (urlVarPair[0] && urlVarPair[0] == urlVarName.toLowerCase()) {
					urlVarValue = urlVarPair[1];
				}
			}
		}
	}
	
	return urlVarValue;
} 

$(document).ready(function() {
	route = getURLVar('route');
	
	if (!route) {
		$('#tab_home').addClass('selected');
	} else {
		part = route.split('/');
		
		if (route == 'common/home') {
			$('#tab_home').addClass('selected');
		} else if (route == 'account/login') {
			$('#tab_login').addClass('selected');	
		} else if (part[0] == 'account') {
			$('#tab_account').addClass('selected');
		} else if (route == 'checkout/cart') {
			$('#tab_cart').addClass('selected');
		} else if (part[0] == 'checkout') {
			$('#tab_checkout').addClass('selected');
		} else {
			$('#tab_home').addClass('selected');
		}
	}
});
//--></script>
<script type="text/javascript"><!--
$('#search input').keydown(function(e) {
	if (e.keyCode == 13) {
		moduleSearch();
	}
});

function moduleSearch() {
	url = 'index.php?route=product/search';
	
	var filter_keyword = $('#filter_keyword').attr('value')
	
	if (filter_keyword) {
		url += '&keyword=' + encodeURIComponent(filter_keyword);
	}
	
	var filter_category_id = $('#filter_category_id').attr('value');
	
	if (filter_category_id) {
		url += '&category_id=' + filter_category_id;
	}
	
	location = url;
}
//--></script>
<script type="text/javascript"><!--
$('.switcher').bind('click', function() {
	$(this).find('.option').slideToggle('fast');
});
$('.switcher').bind('mouseleave', function() {
	$(this).find('.option').slideUp('fast');
}); 
//--></script>
